-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Fixing issue #35530: Password Leak in Log Messages #35584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fixing issue #35530: Password Leak in Log Messages #35584
Conversation
…contained in the connString
It's better to call |
That seems more secure, but again this would be adding a few bit of lines to all the log statements and for the majority of time we may not even need it. Is this extra cost acceptable ? |
Personally I think it's worth to make the logger system more secure, but I am fine with either (current approach, or calling SanitizeCredentialURLs for all log messages). It's up to the reviewers. @lunny @techknowlogick |
I think as a quick patch, this is enough. Adding a log level check requires balancing performance and security. Most log format arguments don’t need such checks, but verifying the log level can help prevent potential leaks of sensitive information. Alternatively, we could introduce a dedicated type, for example, |
I sent #35594 as an example how it might be. |
Summary
The Gitea codebase was logging
Elasticsearch
andMeilisearch
connection strings directly to log files without sanitizing them. Since connection strings often contain credentials in the formatprotocol://username:password@host:port
, this resulted in passwords being exposed in plain text in log output.Fix:
util.SanitizeCredentialURLs()
function before logging them.Fixes: #35530